package finalProject;

public class Token {

	private String word;
	private String posTag;
	private String depLabel;
	private int headIndex;
	static Stemmer stemmer = new Stemmer();
	
	public Token(String biarc)
	{
		String[] parts = biarc.split("/");
		int size = parts.length;
		this.word = parts[0];
		for(int i = 1 ; i <= size - 4 ; i++)
		{
			this.word += "/" + parts[i];
		}
		
		stemmer.add(word.toCharArray(), word.length());
		stemmer.stem();
		this.word = stemmer.toString();
		
		this.posTag = parts[size-3];
		this.depLabel = parts[size-2];
		this.headIndex = Integer.parseInt(parts[size-1].trim());
	}
	
	public boolean isNoun()
	{
		return this.posTag.equals("NN") || this.posTag.equals("NNS")
				|| this.posTag.equals("NNP") || this.posTag.equals("NNPS");
	}

	public String getWord() {
		return word;
	}

	public String getPosTag() {
		return posTag;
	}

	public String getDepLabel() {
		return depLabel;
	}

	public int getHeadIndex() {
		return headIndex;
	}
	
	@Override
	public String toString() {
		return this.word;
	}
	
}
